﻿@using Lari.Configuration
@model Lari.Services.ViewModel.DepartmentDesignationModel
@{
    Layout = "~/Views/Shared/DialogLayout.cshtml";
    var buttonText = "";
}
<div style="float: right">
    Departemnt:&nbsp;<strong> @Model.DeapartmentName</strong>
</div>
@if (Model.Designations != null && Model.Designations.Count > 0)
{
    <div style="float: left">
        <a href="#top" class="moduleLink">Top</a>&nbsp;&nbsp;&nbsp;<a class="moduleLink" href="#bottom">Bottom</a>
    </div>
}
<div class="clear">
</div>
<div class="spacer">
</div>
@using (Ajax.BeginForm(ActionConst.Masters.Common.DepDesignationModify, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "popUpDialog" }))
{
    if (Model.Designations != null && Model.Designations.Count > 0)
    {
    <div style="height: 350px; overflow: auto">
        @for (int i = 0; i < Model.Designations.Count; i++)
        {
            if (i == 0)
            {
             <a id="top" />
            }
            <div style="border-bottom: 0px solid #DADADA; border-top: 1px solid #DADADA; padding-top: 3px;
                                                                                 padding-bottom: 3px;cursor:pointer">
                @Html.CheckBoxFor(m => m.Designations[i].IsMapped)
                @Html.HiddenFor(m => m.Designations[i].DesignationName)
                <label>@Model.Designations[i].DesignationName</label>
                @Html.HiddenFor(m => m.Designations[i].DesignationId)
            </div>
            if (i == Model.Designations.Count-1)
            {
             <a id="bottom" />
            }

        }
    </div>
        buttonText = GuiActionName.Update;

    }

    if (Model.Designations == null || Model.Designations.Count <= 0)
    {
        buttonText = GuiActionName.NewMapping;


    }
    <p style="float: right">
        @Html.HiddenFor(m => m.DepartmentId)
        @Html.HiddenFor(m => m.DeapartmentName)
        <input type="submit" value="@buttonText" id="newMapping" />
    </p>

}
<script type="text/javascript">
    $(document).ready(function () {
        $("#newMapping").button();
    });
</script>
